<!-- 搜索表单 -->
<template>
  <ele-card :body-style="{ paddingBottom: '2px' }">
    <el-form label-width="72px" @keyup.enter="search" @submit.prevent="">
      <el-row :gutter="8">
        <el-col :lg="6" :md="12" :sm="12" :xs="24">
          <el-form-item label="员工名称">
            <el-input
              clearable
              v-model.trim="form.employeeName"
              placeholder="请输入"
            />
          </el-form-item>
        </el-col>
        <el-col :lg="6" :md="12" :sm="12" :xs="24">
          <el-form-item label="设备号">
            <el-input
              clearable
              v-model.trim="form.deviceId"
              placeholder="请输入"
            />
          </el-form-item>
        </el-col>
        <el-col :lg="6" :md="12" :sm="12" :xs="24">
          <el-form-item label="设备版本号">
            <el-input
              clearable
              v-model.trim="form.deviceVersion"
              placeholder="请输入"
            />
          </el-form-item>
        </el-col>
        <el-col :lg="6" :md="12" :sm="12" :xs="24">
          <el-form-item label="电量 1.低 2.中 3.高">
            <el-input
              clearable
              v-model.trim="form.batteryLevel"
              placeholder="请输入"
            />
          </el-form-item>
        </el-col>
        <el-col :lg="6" :md="12" :sm="12" :xs="24">
          <el-form-item label="所属组织">
            <el-input
              clearable
              v-model.trim="form.deptId"
              placeholder="请输入"
            />
          </el-form-item>
        </el-col>
        <el-col :lg="6" :md="12" :sm="12" :xs="24">
          <el-form-item label="最近心跳">
            <el-input
              clearable
              v-model.trim="form.lastHeartbeat"
              placeholder="请输入"
            />
          </el-form-item>
        </el-col>
        <el-col :lg="6" :md="12" :sm="12" :xs="24">
          <el-form-item label="是否在线">
            <el-input
              clearable
              v-model.trim="form.isOnline"
              placeholder="请输入"
            />
          </el-form-item>
        </el-col>
        <el-col :lg="6" :md="12" :sm="12" :xs="24">
          <el-form-item label="状态 0.闲置,1.离线,2.正在接待">
            <el-input
              clearable
              v-model.trim="form.status"
              placeholder="请输入"
            />
          </el-form-item>
        </el-col>
        <el-col :lg="6" :md="12" :sm="12" :xs="24">
          <el-form-item label="待上传文件">
            <el-input
              clearable
              v-model.trim="form.pendingUpload"
              placeholder="请输入"
            />
          </el-form-item>
        </el-col>
        <el-col :lg="6" :md="12" :sm="12" :xs="24">
          <el-form-item label="剩余存储空间(KB)">
            <el-input
              clearable
              v-model.trim="form.storageRemaining"
              placeholder="请输入"
            />
          </el-form-item>
        </el-col>
        <el-col :lg="6" :md="12" :sm="12" :xs="24">
          <el-form-item label="信号值">
            <el-input
              clearable
              v-model.trim="form.signalStrength"
              placeholder="请输入"
            />
          </el-form-item>
        </el-col>
        <el-col :lg="6" :md="12" :sm="12" :xs="24">
          <el-form-item label="录音总时长(秒)">
            <el-input
              clearable
              v-model.trim="form.totalRecordingDuration"
              placeholder="请输入"
            />
          </el-form-item>
        </el-col>
        <el-col :lg="6" :md="12" :sm="12" :xs="24">
          <el-form-item label="录音次数">
            <el-input
              clearable
              v-model.trim="form.recordingCount"
              placeholder="请输入"
            />
          </el-form-item>
        </el-col>
        <el-col :lg="6" :md="12" :sm="12" :xs="24">
          <el-form-item label="创建人">
            <el-input
              clearable
              v-model.trim="form.createdBy"
              placeholder="请输入"
            />
          </el-form-item>
        </el-col>
        <el-col :lg="6" :md="12" :sm="12" :xs="24">
          <el-form-item label="创建时间">
            <el-input
              clearable
              v-model.trim="form.createdTime"
              placeholder="请输入"
            />
          </el-form-item>
        </el-col>
        <el-col :lg="6" :md="12" :sm="12" :xs="24">
          <el-form-item label-width="16px">
            <el-button type="primary" @click="search">查询</el-button>
            <el-button @click="reset">重置</el-button>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
  </ele-card>
</template>

<script setup>
  import { useFormData } from '@/utils/use-form-data';

  const emit = defineEmits(['search']);

  /** 表单数据 */
  const [form, resetFields] = useFormData({
    employeeName: '',
    deviceId: '',
    deviceVersion: '',
    batteryLevel: void 0,
    deptId: void 0,
    lastHeartbeat: '',
    isOnline: void 0,
    status: void 0,
    pendingUpload: void 0,
    storageRemaining: void 0,
    signalStrength: void 0,
    totalRecordingDuration: void 0,
    recordingCount: void 0,
    createdBy: '',
    createdTime: ''
  });

  /** 搜索 */
  const search = () => {
    emit('search', { ...form });
  };

  /**  重置 */
  const reset = () => {
    resetFields();
    search();
  };
</script>
